﻿#ifndef DIALOGLOGIN_H
#define DIALOGLOGIN_H

#include <qdialog.h>
#include "ObjAutoInject.h"
//#include <qevent.h>

namespace Ui {
  class DialogLogin;
}

class MainWindow;
class UserRegisterCodec;
class TcpIOer;
class UserInfoCodec;
class DialogLogin : public QDialog,public ObjAutoInject
{
  Q_OBJECT
private://dependency
  MainWindow* mainWindow=Q_NULLPTR;
  UserRegisterCodec* userRegisterCodec=Q_NULLPTR;
  TcpIOer* tcpIOer=Q_NULLPTR;
  UserInfoCodec* userInfoCodec=Q_NULLPTR;
public:
  explicit DialogLogin(QWidget *parent = nullptr);
  virtual ~DialogLogin();
private slots:
  void slot_pushButton_login();
  void slot_pushButton_exit();
  void slot_handleResult(uchar result);
protected:
  virtual void closeEvent(QCloseEvent * closeEvent) override;
public://geter and seter
  MainWindow* getMainWindow()const;
  DialogLogin* setMainWindow(MainWindow* const mainWindow);
  UserRegisterCodec* getUserRegisterCodec()const;
  DialogLogin* setUserRegisterCodec(UserRegisterCodec* const userRegisterCodec);
  TcpIOer* getTcpIOer()const;
  DialogLogin* setTcpIOer(TcpIOer* const tcpIOer);
  UserInfoCodec* getUserInfoCodec()const;
  DialogLogin* setUserInfoCodec(UserInfoCodec* const userInfoCodec);
public:
  virtual void objectAutoInjection(QHash<QString,QObject*>* objMap)override;

private:
  Ui::DialogLogin *ui;
};

#endif // DIALOGLOGIN_H
